package com.renchi.menu.Leaving.controller;

import com.renchi.menu.Leaving.entity.LeavDbEntity;
import com.renchi.menu.Leaving.service.LeavDbService;
import com.renchi.menu.Leaving.vo.LeavDbVo;
import com.renchi.menu.common.page.PageInfo;
import com.renchi.menu.common.result.Result;
import com.renchi.menu.common.result.ResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "leaving")
public class LeavDbController {
    @Autowired
    private LeavDbService leavDbService;

    /**
     * 保存留言
     * @param leavDbEntity
     * @return
     */
    @RequestMapping(value = "saveLeavDb",method = RequestMethod.POST)
    public Result saveLeavDb(LeavDbEntity leavDbEntity){
        return leavDbService.saveLeavDb(leavDbEntity);
    }

    /**
     * 查询留言数据
     * @param leavDbVo
     * @return
     */
    @RequestMapping(value = "findLeavDb",method = RequestMethod.POST)
    ResultModel<PageInfo<LeavDbVo>> findLeavDb(LeavDbVo leavDbVo){
        return leavDbService.findLeavDb(leavDbVo);
    }
}
